import Vue from 'vue'
import VueRouter from 'vue-router'
import DefaultLayout from '../layout/default'
import TabLayout from '../layout/tabLayout'

Vue.use(VueRouter)
/*
* meta:{}
* @param {navigationStyle} default{默认样式} |  custom
*
*
*
*
*
*
*
* */
const routes = [
    {
        path: '/',
        redirect: '/tabs',
        component: DefaultLayout,
        children: [
            {
                path: 'login',
                name: 'login',
                meta: {
                    navigationBarTitleText: '登录',
                    navigationBarBackgroundColor: 'red',
                    backgroundTextStyle: '#fff',
                    // navigationStyle:'custom'
                },
                // route level code-splitting
                // this generates a separate chunk (about.[hash].js) for this route
                // which is lazy-loaded when the route is visited.
                component: () => import(/* webpackChunkName: "about" */ '../views/login.vue')
            },
            {
                path: 'register',
                name: 'register',
                meta: {
                    navigationBarTitleText: '注册'
                },
                // route level code-splitting
                // this generates a separate chunk (about.[hash].js) for this route
                // which is lazy-loaded when the route is visited.
                component: () => import(/* webpackChunkName: "about" */ '../views/register.vue')
            },
            {
                path: 'addressList',
                name: 'addressList',
                meta: {
                    navigationBarTitleText: '地址管理'
                },
                // route level code-splitting
                // this generates a separate chunk (about.[hash].js) for this route
                // which is lazy-loaded when the route is visited.
                component: () => import(/* webpackChunkName: "about" */ '../views/addressList.vue')
            },
            {
                path: 'addressEdit',
                name: 'addressEdit',
                meta: {
                    navigationBarTitleText: '地址编辑'
                },
                // route level code-splitting
                // this generates a separate chunk (about.[hash].js) for this route
                // which is lazy-loaded when the route is visited.
                component: () => import(/* webpackChunkName: "about" */ '../views/addressEdit.vue')
            },
            {
                path: 'search',
                name: 'search',
                meta: {
                    navigationBarTitleText: '搜索'
                },
                // route level code-splitting
                // this generates a separate chunk (about.[hash].js) for this route
                // which is lazy-loaded when the route is visited.
                component: () => import(/* webpackChunkName: "about" */ '../views/search.vue')
            }
        ]
    },
    {
        path: '/tabs',
        name: 'tabs',
        component: TabLayout,
        redirect: '/tabs/home',
        children: [
            {
                path: 'home',
                name: 'home',
                meta: {
                    navigationStyle: 'custom',
                    navigationBarTitleText: '首页'
                },
                component: () => import(/* webpackChunkName: "about" */ '../views/home.vue')
            },
            {
                path: 'shop',
                name: 'shop',
                meta: {
                    navigationStyle: 'custom',
                    navigationBarTitleText: '商城'
                },
                component: () => import(/* webpackChunkName: "about" */ '../views/shop.vue')
            }, {
                path: 'shoppingCart',
                name: 'shoppingCart',
                meta: {
                    navigationBarTitleText: '购物车',
                    navigationStyle: 'custom'
                },
                component: () => import(/* webpackChunkName: "about" */ '../views/shoppingCart.vue')
            },
            {
                path: 'mine',
                name: 'mine',
                meta: {
                    navigationStyle: 'custom',
                    navigationBarTitleText: '我的'
                },
                component: () => import(/* webpackChunkName: "about" */ '../views/mine.vue')
            }
        ]
    },

]

const router = new VueRouter({
    // mode: 'history',
    base: process.env.BASE_URL,
    routes
})




export default router
